package ttu.idu0080.ryhm103_courierService;

import java.util.List;

import javax.jws.WebService;

import ttu.idu0080.courierService_client.Courier;
import ttu.idu0080.courierService_client.CourierService_CourierServicePort_Client;
import ttu.idu0080.ryhm103_logger.OrderServicesLogger;

@WebService(targetNamespace = "http://ryhm103_courierService.idu0080.ttu/", endpointInterface = "ttu.idu0080.ryhm103_courierService.ryhm103_CourierService", portName = "CourierServiceImplPort", serviceName = "CourierServiceImplService")
public class CourierServiceImpl implements ryhm103_CourierService {

	public List<Courier> getAllCouriers(){
		CourierService_CourierServicePort_Client courierClient=new CourierService_CourierServicePort_Client();
		List<Courier> couriersList=null;
		
		try {
			couriersList=courierClient.getAllCouriers();
			 OrderServicesLogger.log("Courierservice starts", true);
            for (Courier courier : couriersList) {
            	OrderServicesLogger.log("Courier : " + courier.getName(), false);
            }
            OrderServicesLogger.log("Courierservice ends", true);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return couriersList;
	}
}
